import { createRouter, createWebHistory } from 'vue-router'
import { constantRouteMap } from './router.config'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: constantRouteMap,
  scrollBehavior(to) {
    if (to.hash) {
      return {
        el: to.hash,
        top: 100,
        behavior: 'smooth',
      }
    }
  },
})

export default router
